// 云函数入口文件
const cloud = require('wx-server-sdk')
var rp = require('request-promise');
cloud.init()
const db = cloud.database();
const _ = db.command;
// 云函数入口函数
exports.main = async (event, context) => {
  const openid = cloud.getWXContext().OPENID
  var {datas} = event;
  var url ="https://api.mch.weixin.qq.com/v3/transfer/batches"
  return await rp({
    url: url,
    method: "POST",
    json: true,
    body: datas,
    headers: {
      "content-type": "application/json",
      'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
    },
  })
    .then(function (res) {
      return res
    })
    .catch(function (err) {
      return err
    });
}